//
//  LGSBasicBinaryGate.m
//  LogicSim
//
//  Created by Jeremy Pereira on 14/02/2013.
//
//

#import "LGSBasicBinaryGate.h"
#import "LGSName.h"

@implementation LGSBasicBinaryGate

-(TimeTick) gateDelay
{
    return 1;
}

+(NSArray*) defaultInputNames
{
    return @[[LGSName nameWithConnectionString: @"a"],
             [LGSName nameWithConnectionString: @"b"]];
}

+(NSArray*) defaultOutputNames
{
    return @[[LGSName nameWithConnectionString: @"output"]];
}

+(LGSName*) inputAName
{
    static LGSName* aName = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken,
    ^{
        aName = [[LGSName alloc] initWithNodePart: nil
                                   connectionPart: @"a"
                                        nodeIndex: LGS_NAME_NO_INDEX
                                  connectionIndex: LGS_NAME_NO_INDEX];
    });
    return aName;
}

+(LGSName*) inputBName
{
    static LGSName* aName = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken,
                  ^{
                      aName = [[LGSName alloc] initWithNodePart: nil
                                                 connectionPart: @"b"
                                                      nodeIndex: LGS_NAME_NO_INDEX
                                                connectionIndex: LGS_NAME_NO_INDEX];
                  });
    return aName;
}

+(LGSName*) outputName
{
    static LGSName* aName = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken,
                  ^{
                      aName = [[LGSName alloc] initWithNodePart: nil
                                                 connectionPart: @"output"
                                                      nodeIndex: LGS_NAME_NO_INDEX
                                                connectionIndex: LGS_NAME_NO_INDEX];
                  });
    return aName;
}


@end
